package com.by.bean;

import com.by.common.group.ISave;
import com.by.common.group.IUpdate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;

@ApiModel("用户")
@Data
public class User {
    @Min(value = 1, message = "修改时用户id不能为空", groups = {IUpdate.class})
    @ApiModelProperty(name = "id", value = "用户id", hidden = true, required = false)
    int id;

    @NotBlank(message = "用户名不能为空！")
    @ApiModelProperty(value = "用户名", required = true)
    String account;

    //@NotBlank(message = "密码不能为空！")
    @NotNull(message = "密码不能为空！", groups = {ISave.class, IUpdate.class})
    @Pattern(regexp = "^[a-zA-Z0-9_]{6,12}$", message = "密码由字母、数字、下滑线组成的6-12位", groups = {ISave.class, IUpdate.class})
    @ApiModelProperty(name = "password", value = "密码", required = true)
    String password;

    @ApiModelProperty(value = "用户类型", hidden = true)
    int type;

}
